/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 battlefield_metrics.cpp

	$Header: /heroes4/battlefield_metrics.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )


#include "battlefield_metrics.h"

// -----------------------------------------------------------------------
// t_battlefield_view_size_properties
// -----------------------------------------------------------------------


t_battlefield_view_size::t_battlefield_view_size( t_screen_point const & size_arg )
	:	size( size_arg ),
		view_ratio( t_rational< int >( size_arg.x, k_battlefield_logical_view_width ),
			        t_rational< int >( size_arg.y, k_battlefield_logical_view_height ) )
{
}

t_battlefield_view_size const&
	get_battlefield_view_size( t_battlefield_view_size_id view_size )
{
	assert( view_size >= 0 && view_size < k_view_size_count );

	static t_battlefield_view_size const 
		k_view_size_properties_array[ k_view_size_count ] =
	{
		t_screen_point( 691, 600 ),
		t_screen_point( 885, 768 ),
		t_screen_point( 1180, 1024 ),
	};

	return k_view_size_properties_array[ view_size ];
}

// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
t_battlefield_view_size_id compute_view_size_id( t_screen_point const & view_size )
{
	if ( view_size == t_screen_point( 800, 600 ) )
		return k_view_size_small;

	if ( view_size == t_screen_point( 1024, 768 ) )
		return k_view_size_medium;

	assert( view_size == t_screen_point( 1280, 1024 ) );
	return k_view_size_large;
}

